

package user





//getUserInfoListCount 获取用户信息列表条数
const getUserInfoListCount = `
select 
	count(1)
from sso_user_info t
where
	?t.full_name
	and t.create_time >=  if(@start_create_time='', t.create_time,@start_create_time)
	and t.create_time <  date_add(if(@end_create_time='',t.create_time,@end_create_time), interval 1 day)
	&t.status
	&t.source
	and t.last_login_time >=  if(@last_login_time='',t.last_login_time,@last_login_time)
	and t.last_login_time <  date_add(if(@last_login_time='',t.last_login_time,@last_login_time),interval 1 day)`


	
//getUserInfoList 查询用户信息列表数据
const getUserInfoList = `
select
	t.user_id,
	t.full_name,
	t.user_name,
	t.email,
	t.mobile,
	t.create_time,
	t.status,
	t.last_login_time,
	t.wx_openid,
	t.changepwd_times,
	t.ext_params,
	t.source_id,
	t.source,
	t.max_failed_cnt,
	t.curr_failed_cnt,
	t.last_failed_time,
	1
from sso_user_info t
where
	?t.full_name
	and t.create_time >=  if(@start_create_time='', t.create_time,@start_create_time)
	and t.create_time <  date_add(if(@end_create_time='',t.create_time,@end_create_time), interval 1 day)
	&t.status
	&t.source
	and t.last_login_time >=  if(@last_login_time='',t.last_login_time,@last_login_time)
	and t.last_login_time <  date_add(if(@last_login_time='',t.last_login_time,@last_login_time),interval 1 day)
order by 
	t.user_id desc
limit @ps offset @offset`

// insertUserInfo 保存用户信息数据
const insertUserInfo = `
insert into sso_user_info
(
	full_name,
	user_name,
	password,
	email,
	mobile,
	ext_params,
	status
	)
values
(
	@full_name,
	@user_name,
	@password,
	@email,
	@mobile,
	@ext_params,
	@status
	)`

//updateUserInfo 修改用户信息数据
const updateUserInfo = `
update sso_user_info t set
	t.full_name = @full_name,
	t.user_name = @user_name,
	t.email = @email,
	t.mobile = @mobile,
	t.ext_params = @ext_params,
	t.status = @status
where
	&user_id`

//getUserInfo 查询单条用户信息数据
const getUserInfo = `
select
	t.user_id,
	t.full_name,
	t.user_name,
	t.email,
	t.mobile,
	t.create_time,
	t.status,
	t.last_login_time,
	t.wx_openid,
	t.changepwd_times,
	t.ext_params,
	t.source_id,
	t.source,
	t.max_failed_cnt,
	t.curr_failed_cnt,
	t.last_failed_time
from sso_user_info t
where
	&user_id`


//deleteUserInfo 删除单条用户信息数据
const deleteUserInfo = `
delete from sso_user_info
where
	&user_id`